package legumes.client.services.callbacks;

import legumes.client.services.LegumesServicesHelper;
import legumes.client.services.util.rpc.SequencableRPCCall;
import legumes.shared.domain.Order;

public class HasOrderConflictCallback extends SequencableRPCCall<Boolean> {
	private long sellSessionId;
	private boolean hasOrderConflict;
	private Order order;

	public HasOrderConflictCallback(long sellSessionId_, Order order_) {
		sellSessionId = sellSessionId_;
		order = order_;
	}

	@Override
	protected void doCall() {
		LegumesServicesHelper.LEGUMES_SERVICES.hasOrderConflict(sellSessionId,
				order, this);
	}

	public void onSuccess(Boolean isOpened_) {
		hasOrderConflict = isOpened_;
		callNext();
	}

	public boolean hasOrderConflict() {
		return hasOrderConflict;
	}
}
